import 'package:flutter/material.dart';

import 'package:flutter_demo/datas/homeDatas.dart';

import 'package:flutter_demo/widgets/bannerWidget.dart';
import 'package:flutter_demo/widgets/ensureWidget.dart';

import 'package:flutter_demo/widgets/groupBookingWidget.dart';
import 'package:flutter_demo/widgets/activityWidget.dart';
import 'package:flutter_demo/widgets/newsWidget.dart';
import 'package:flutter_demo/widgets/featuresWidget.dart';
import 'package:flutter_demo/widgets/likeWidget.dart';

class HomePage extends StatefulWidget {
  @override
  _CarPageState createState() => _CarPageState();
}

class _CarPageState extends State<HomePage> {
  List<Widget> _groups = [
    MBanner(banners), // banner
    MEnsure(ensures), // 品牌保证
    MGroupBooking(items: groupBookingItems), // 好物拼团
    MActivity(items: activityItems), // 活动推荐
    MNews(items: newsItems), // 新品首发
    MFeatures(features: features), // 特色品牌
    MLike(items: likeItems), // 猜你喜欢
  ];

  @override
  Widget build(BuildContext context) {
    return new ListView.builder(
      itemBuilder: (BuildContext context, int index) => _groups[index],
      itemCount: _groups.length,
    );
  }
}
